package com.ym.medical.service.impl;

import com.ym.core.utils.tkmybatis.BaseSVImpl;
import com.ym.medical.dao.HealthCoinSourceSettingDao;
import com.ym.medical.domain.entity.HealthCoinSourceSettingEntity;
import com.ym.medical.domain.param.HealthCoinSourceSettingQueryParam;
import com.ym.medical.domain.param.HealthCoinSourceSettingUpdateParam;
import com.ym.medical.domain.vo.HealthCoinSourceSettingListPcVO;
import com.ym.medical.service.IHealthCoinSourceSettingSV;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
                                                                                            
/**
* 健康币获取渠道设置Service业务层处理
*
* @author ym
* @date 2020-09-16
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class HealthCoinSourceSettingSVImpl extends BaseSVImpl<HealthCoinSourceSettingEntity,HealthCoinSourceSettingDao> implements IHealthCoinSourceSettingSV {

	/**
	 * 查询健康币获取渠道设置列表
	 *
	 * @param queryParam 健康币获取渠道设置 查询参数
	 * @return 健康币获取渠道设置
	 */
	@Override
	public List<HealthCoinSourceSettingListPcVO> selectListPC(HealthCoinSourceSettingQueryParam queryParam) {
		List<HealthCoinSourceSettingListPcVO> healthCoinSourceSettings = mapper.selectListPC(queryParam);
		return healthCoinSourceSettings;
	}

	/**
	 * 新增健康币获取渠道设置
	 *
	 * @param updateParam 健康币获取渠道设置 新增参数
	 * @return 结果
	 */
	@Override
	public Long insertPC(HealthCoinSourceSettingUpdateParam updateParam) {
            HealthCoinSourceSettingEntity entity = updateParam.covert();
		this.insert(entity);
		return entity.getId();
	}

	/**
	 * 修改健康币获取渠道设置
	 *
	 * @param updateParam 健康币获取渠道设置 修改参数
	 * @return 结果
	 */
	@Override
	public int updateByIdPC(HealthCoinSourceSettingUpdateParam updateParam) {
            HealthCoinSourceSettingEntity entity = updateParam.covert("createTime");
		int result = this.updateById(entity);
		return result;
	}

	@Override
	public List<HealthCoinSourceSettingEntity> checkUserCondition() {
		return mapper.checkUserCondition();
	}
}
